﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;


namespace WPFView
{
    /// <summary>
    /// Interaction logic for LogView.xaml
    /// </summary>
    public partial class LogView : Window
    {
        public LogView()
        {
            InitializeComponent();
      
        }
        public string[] Logs
        {
            set
            {
                var textRange = new TextRange(LogsRichTextBox.Document.ContentStart, LogsRichTextBox.Document.ContentEnd);
                string[] lines = textRange.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
                lines = value;
                Paragraph paragraph = new Paragraph();
                foreach (string line in lines)
                {
                    paragraph.Inlines.Add(new Run(line));
                }
                FlowDocument flowDocument = new FlowDocument(paragraph);
                LogsRichTextBox.Document = flowDocument;

                Visibility = System.Windows.Visibility.Visible;
            }

        }
        
    }
}
